#include<func.h>
void * threadfunc(void* p)
{
    char buf[128]={0};
    time_t now;
    time(&now);
    char *q=ctime_r(&now,buf);
    printf("child thread  ctime_r=%s",buf);
    sleep(3);
    printf("child thread second ctime_r=%s",buf);
    pthread_exit(NULL);
}
int main()
{
    pthread_t pthid;
    int ret=pthread_create(&pthid,NULL,threadfunc,NULL);
    THREAD_ERR_CHECK(ret,"pthread_create");
    sleep(1);
    char buf[128]={0};
    time_t now;
    time(&now);
    char *p=ctime_r(&now,buf);
    printf("main thread ctime_r=%s",buf);
    pthread_join(pthid,NULL);
    return 0;
}